<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>見積管理</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>

		<script src="assets/scripts/ui/jquery-ui-1.7.2.custom.js" type="text/javascript"></script>
		<link type="text/css" href="./assets/styles/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript">
		$(function() {
			// メッセージのフェード
			$('.message').fadeIn("slow");

		});
		
		function goBack(shop_id,shop_name,refer_price,cost_price,s_unit,style){
			if(!window.opener.validationRepeat(shop_id,{{php}}echo $_GET['id']{{/php}})){
				alert("重複商品を挿入することはできません");
				return ;
			}
			window.opener.document.getElementById("style_{{php}}echo $_GET['id']{{/php}}").value=style;
			window.opener.document.getElementById("shop_id_{{php}}echo $_GET['id']{{/php}}").value=shop_id;
			window.opener.document.getElementById("shop_name_{{php}}echo $_GET['id']{{/php}}").value=shop_name;
			window.opener.document.getElementById("refer_price_{{php}}echo $_GET['id']{{/php}}").value=parseInt(refer_price);
			window.opener.document.getElementById("s_unit_{{php}}echo $_GET['id']{{/php}}").value=s_unit;
			window.opener.document.getElementById("multiple_{{php}}echo $_GET['id']{{/php}}").value=1.0;
			window.opener.document.getElementById("num_{{php}}echo $_GET['id']{{/php}}").value=1;
			window.opener.document.getElementById("cost_price_{{php}}echo $_GET['id']{{/php}}").value=cost_price;
			window.opener.document.getElementById("money_{{php}}echo $_GET['id']{{/php}}").innerHTML=formatNumber(parseInt(refer_price)*1*1);
			var m = parseFloat(refer_price)*1.0*1;
			window.opener.document.getElementById("profit_{{php}}echo $_GET['id']{{/php}}").innerHTML=parseInt(((m-cost_price*1)/m)*100)+"%";
			window.opener.compute();
			window.close();
			
		}
		
		function formatNumber(str) { 
			str=str+"";
		    if(str.length <= 3){  
		        return str;  
		    } else {  
		        return formatNumber(str.substr(0,str.length-3))+','+str.substr(str.length-3);  
		    }  
		}  
		</script>
	
	</head>
	<body  >
	
		<div id="container"><div class="wrapper">

			<h3>見積書コピー　顧客選択</h3>
			
			<p class="message">顧客を変更しない。</p>
			
			<form action="consumer_select.php" method="get">
			<input type="hidden" name="price_no" value="{{$forms.price_no}}" />
			<table id="inquiry_result" class="formTable">
				<thead>
					<tr>
						<th><button type="button" onclick="doCopy({{$forms.consumer_id}})" ><span style="font-size:11px">顧客を変更しない</span></button></th>
						<th>顧客名</th>
						<td><input type="text" name="company_name"  class="text" value="{{$forms.company_name}}" /></td>
						<td>
						<input type="submit" style="width: 100%;height: 100%" value="検索" />
						</td>
					</tr>
										
				</thead>			
			</table>
			</form>

			<h3></h3>
			<div style="border:1px solid silver; padding:5px;height:200px;overflow:auto;" >
			<ul>
{{ foreach from=$consumerlist key=k item=v }}
					<li>
						<a href="javascript:doCopy({{$v.consumer_id}})">{{ $v.company_name }}</a>
					</li>
{{ /foreach }}				
			</ul>
			<script>
				function doCopy(cid){
					window.close();
					window.opener.location.href='make_price.php?price_no={{$forms.price_no}}&mod=copy&consumer_id='+cid;
				}
			</script>
			</div>
			
		</div></div>
		
	</body>
</html>